#
# @lc app=leetcode.cn id=168 lang=python3
#
# [168] Excel表列名称
#

# @lc code=start
class Solution:
    def convertToTitle(self, n: int) -> str:
        res = ""
        while n > 0:
            c = n % 26
            if c == 0:
                c = 26
                n -= 1
            res = chr(ord('A') + c - 1) + res
            n //= 26
        return res

# @lc code=end

